//package nbcp.web.config
//
//import ch.qos.logback.core.spi.FilterReply
//import org.slf4j.LoggerFactory
//import org.springframework.beans.factory.annotation.Value
//import org.springframework.context.annotation.Configuration
//import org.springframework.core.Ordered
//import org.springframework.core.annotation.Order
//import org.springframework.web.context.request.RequestAttributes
//import org.springframework.web.context.request.RequestContextHolder
//import org.springframework.web.context.request.ServletRequestAttributes
//import org.springframework.web.filter.OncePerRequestFilter
//
//import nbcp.base.config.MyLogFilter
//import nbcp.base.extend.*
//import nbcp.base.utils.CodeUtil
//import nbcp.base.utils.Md5Util
//import nbcp.base.utils.MyUtil
//import nbcp.db.mongo.entity.TraceLog_Detail
//import nbcp.db.mongo.mor
//import nbcp.db.mongo.match
//import nbcp.db.mongo.update
//import nbcp.db.redis.entity.OpenSessionData
//import nbcp.web.*
//import java.io.ByteArrayInputStream
//import java.io.ObjectInputStream
//import java.nio.charset.Charset
//import java.util.concurrent.atomic.AtomicInteger
//import javax.servlet.*
//import javax.servlet.annotation.WebFilter
//import javax.servlet.http.Cookie
//import javax.servlet.http.HttpServletRequest
//import javax.servlet.http.HttpServletResponse
//
///**
// * Created by udi on 2017.3.11.
// * 不拦截 GET,HEAD,OPTIONS 请求
// */
//
//@Order(Ordered.HIGHEST_PRECEDENCE)
//@Configuration
//@WebFilter(filterName = "myTraceFilter", urlPatterns = arrayOf("/*", "/**"))
////@WebFilter(urlPatterns = arrayOf("/**"), filterName = "MyAllFilter")
////@ConfigurationProperties(prefix = "nbcp.filter")
//open class MyTraceFilter : OncePerRequestFilter() {
//    companion object {
//        private val msgs = ThreadLocal.withInitial { mutableListOf<String>() }
//        private val detail = ThreadLocal.withInitial { TraceLog_Detail() }
//
//        fun addTraceInfo(log:TraceLog_Detail){
//
//        }
//    }
//
//    override fun doFilterInternal(request: HttpServletRequest, response: HttpServletResponse, chain: FilterChain) {
//         chain.doFilter(request,response)
//
//        if(msgs.get().any() ==false){
//            return
//        }
//
//        var traceId = request.getAttribute(".trace.id.").AsString()
//        if (traceId.isEmpty()) {
//            return
//        }
//
//
//
//        mor.system.traceLog.update()
//                .where { it.traceId match traceId }
//                .push({ it.details }, detail)
//                .exec()
//    }
//
//}